

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>问卷管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <#include "../../include/layui.ftl" />
    <#include "../../include/pTable.ftl" />
    <script type="text/javascript" src="${path}/plug-in/js/jquery-3.4.1.min.js"></script>
    <script type="text/javascript" src="${path}/plug-in/js/jquery.jqprint-0.3.js"></script>
    <script type="text/javascript" src="${path}/plug-in/js/jquery-migrate-1.2.1.min.js"></script>

</head>
<body>

<div class="layui-fluid">
    <div class="layui-card">
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <form  id="queryForm">
                <input type="hidden" id="className" name="className" value="${className!}" />
                <input type="hidden" id="modleName" name="modleName" value="${modleName!}" />
                <input type="hidden"  name="createrId" value="${SESSION_USER.user.id!}" />
                <input type="hidden" name="createrId_searchType" value="eq">
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <label class="layui-form-label">产妇姓名</label>
                        <div class="layui-input-block">
                            <input type="text" name="maternalName" placeholder="请输入" autocomplete="off" class="layui-input">
                            <input type="hidden" name="maternalName_searchType" value="like">
                        </div>
                    </div>
                </div>
            </form>
        </div>

        <div class="layui-card-body">

            <table id="lay-table" lay-filter="lay-table"></table>
            <script type="text/html" id="toolbar">
            </script>
        </div>
    </div>
</div>
<script>
    layui.config({
        base: '${path}/plug-in/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['index','tables','layers','view'],function () {
        var tables = layui.tables,
            table = layui.table,
            view = layui.view,
            layer = layui.layer,
            layers = layui.layers,
            $ = layui.$;
        var parmer = {
            url:'/console/checkNote/rewrite/list',  // '/console/com.fs.common.pojo.CheckNote/list'
            defaultToolbar: ['filter'],
            where:{sort : 'create_time',order:'desc',createrId:"${SESSION_USER.user.id!}",createrId_searchType:"eq" },
            cols:[[
                    {field:"maternalName",width:120,title:"产妇姓名"}
                    ,{field:"deliveryDay",width:120,title:"分娩日期",templet:function (d) {
                        return d.deliveryDay != null? d.deliveryDay.split(" ")[0] : d.deliveryDay;
                    }}
                    ,{field:"deliveryType",width:120,title:"分娩方式",templet:function (d) {
                        return d.deliveryType == "0"? "顺产" : "剖腹产";
                    }}
                    ,{field:"maternalNation",width:100,title:"民族"}
                    ,{field:"avoidFood",width:250,title:"忌口"}
                    ,{field:"maternalMobile",width:180,title:"联系电话"}
                    /*,{field:"roomNumber",width:'10%',title:"房间号"}*/
                    ,{field:"checkStatus",width:120,title:"检查状态",templet:function (d) {
                        var val = "";
                        if (d.checkStatus == -1) val = "<span style='color:gray;'>待检查</span>";
                        if (d.checkStatus == 0) val = "<span style='color:orange;'>检查中...</span>";
                        if (d.checkStatus > 0) val = "<span style='color:green;'>已检查</span>";
                        return val;
                    }}
                  /*  ,{field:"checkResult",width:'10%',title:"检查结果",templet:function (d) {
                        var val = "<span style='color:gray;'>未生成</span>";
                        if (d.checkResult == 0) val = "<span style='color:red;'>面诊失败</span>";
                        if (d.checkResult == 1) val = "<span style='color:red;'>舌诊失败</span>";
                        if (d.checkResult == 2) val = "<span style='color:red;'>全失败</span>";
                        if (d.checkResult == 3) val = "<span style='color:green;'>成功</span>";
                        return val;
                    }}*/
                    /*,{field:"checkJson",width:'15%',title:"选择答案"}*/
                    ,{field:"createTime",width:180,title:"创建时间"}
                    ,{field:"checkResult",width:120,title:"查看菜谱",templet:function (d) {
                        return d.checkStatus == 2? ' <button type="button" onclick=\'viewRecipes("'+d.checkId+'")\' class="layui-btn layui-btn-normal layui-btn-xs">查看</button>' : "未生成";
                    }}
                    ,{field:"address",width:180,title:"检测地址"}
                ]]
        };
        var $tables = tables.renderTable(parmer);

        //头工具栏事件
        table.on('toolbar(lay-table)', function(obj){
            switch(obj.event){
                case '05':
                    var where = $("#queryForm").serializeObject();
                    $tables.reload({
                        where: where,
                        text: {none: '暂无数据！'}
                    });
                    break;
            };
        });
    });

    function viewRecipes(checkId){
        var $ = layui.$
        layer.open({
            type:2,
            title:"",
            content:"/console/checkNote/rewrite/viewRecipes",
            area: ['100%', '100%'],
            btn:['打印','关闭'],
            success:function(){
                window.checkId = checkId;
            },
            btn1:function(index, layero){
                var body = layer.getChildFrame('body', index);
                var content = body.find("#content_div");
                $(content).jqprint({
                    debug: false, //如果是true则可以显示iframe查看效果（iframe默认高和宽都很小，可以再源码中调大），默认是false
                    importCSS: true, //true表示引进原来的页面的css，默认是true。（如果是true，先会找$("link[media=print]")，若没有会去找$("link")中的css文件）
                    printContainer: true, //表示如果原来选择的对象必须被纳入打印（注意：设置为false可能会打破你的CSS规则）。
                    operaSupport: true//表示如果插件也必须支持歌opera浏览器，在这种情况下，它提供了建立一个临时的打印选项卡。默认是true
                });
            },
            btn2: function(index, layero){//关闭
                layer.close(index);
            }
        });
    }
</script>
</body>
</html>